import { createApp } from 'vue'
import App from './App.vue'
// import store from './store'
import router from './router'
import { createPinia } from 'pinia'
const pinia = createPinia()
// 持久化
const piniaPersist = ({ store }) => {
  const storedState = localStorage.getItem(`pinia_${store.$id}`)
  console.log('storedState',storedState)
  if (storedState) {
    store.$patch(JSON.parse(storedState))
  }
  store.$subscribe((mutation, state) => {
    localStorage.setItem(`pinia_${store.$id}`, JSON.stringify(state))
  })
}
pinia.use(piniaPersist)
createApp(App).use(pinia).use(router).mount('#app')
